{ "cells": [ { "cell_type": "markdown", "id": "0", "metadata": {}, "source": [ "# Create Table from YOLO Object Detection\n", "\n", "Create a 3LC Table from YOLO-format dataset with normalized bounding box annotations for efficient object detection workflows.\n", "\n", "![img](../../images/create-yolo-table.png)\n", "\n", "\n", "\n", "YOLO format is popular for its simplicity and efficiency in modern object detection pipelines. The normalized coordinate system and straightforward text-based annotation format make it easy to work with and integrate into training workflows.\n", "\n", "This notebook loads a YOLO-format detection dataset and converts it to a 3LC Table. We process both image files and corresponding text annotation files containing normalized bounding box coordinates and class indices for each detected object.\n" ] }, { "cell_type": "markdown", "id": "1", "metadata": {}, "source": [ "## Project setup\n" ] }, { "cell_type": "code", "execution_count": null, "id": "2", "metadata": {}, "outputs": [], "source": [ "PROJECT_NAME = \"3LC Tutorials - YOLO Detection\"\n", "DATASET_NAME = \"YOLO-Detection-Dataset\"\n", "TABLE_NAME = \"initial-detection\"\n", "DATA_PATH = \"../../../data\"" ] }, { "cell_type": "markdown", "id": "3", "metadata": {}, "source": [ "## Install dependencies\n" ] }, { "cell_type": "code", "execution_count": null, "id": "4", "metadata": {}, "outputs": [], "source": [ "%pip install 3lc" ] }, { "cell_type": "markdown", "id": "5", "metadata": {}, "source": [ "## Imports\n" ] }, { "cell_type": "code", "execution_count": null, "id": "6", "metadata": {}, "outputs": [], "source": [ "from pathlib import Path\n", "\n", "import tlc" ] }, { "cell_type": "markdown", "id": "7", "metadata": {}, "source": [ "## Create Detection Table\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "8", "metadata": {}, "outputs": [], "source": [ "dataset_yaml_file = (Path(DATA_PATH) / \"yolo\" / \"simple.yaml\").absolute()\n", "\n", "assert dataset_yaml_file.exists()\n", "\n", "train_table = tlc.Table.from_yolo(\n", " dataset_yaml_file=str(dataset_yaml_file),\n", " split=\"train\",\n", " project_name=PROJECT_NAME,\n", " dataset_name=DATASET_NAME,\n", " table_name=TABLE_NAME,\n", " task=\"detect\",\n", ")" ] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.12.9" } }, "nbformat": 4, "nbformat_minor": 5 }